package com.xunqi.controller;

import java.time.LocalDateTime;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.xunqi.dao.cluster.ICollectPkgLogDao;
import com.xunqi.domain.CollectPkgLog;
import com.xunqi.dto.ResponseDTO;
import com.xunqi.dto.VisitPluginDTO;
import com.xunqi.util.IdGenerateUtil;

@RestController
@RequestMapping("/plugin")
public class PluginCollectPkgController {
	@Autowired
	private ICollectPkgLogDao collectPkgLogDao;

	/**
	 * 
	 * @return
	 */
	@RequestMapping(value = "/pkg/collect.do", method = RequestMethod.POST)
	public ResponseDTO collectPkg(VisitPluginDTO visit) {
		CollectPkgLog log = new CollectPkgLog(IdGenerateUtil.generateIdByTimeStamp(), visit.getImei(), visit.getImsi(),
				visit.getCid(), visit.getUuid(), visit.getInslpkgs(), LocalDateTime.now());
		collectPkgLogDao.saveCollectPkgLog(log);
		return ResponseDTO.SUCCESS;
	}
}
